#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h> 

#define BUFFERSIZE 256
#define INIT 1
#define REGISTRATION_COMPLETE '2'
#define REQUESTUPDATE '3'
#define UPDATE 4
#define HALLCALL '5'
#define ELEVATORCALL '6'


/*------------------------------------------
Message Protocols
Sent Messages
INIT - ID(byte)
UPDATE - ID(byte), STATE(byte), CURRENTFLOOR(byte), NEXTDEST(byte), DESTINATIONCOUNT(byte), DESTINATIONS(byte[])

Received Messages
REGISTRATION_COMPLETE - no other arguments
REQUESTUPDATE - no other arguments
HALLCALL - FLOORNUMBER(byte), DIRECTION(byte)
--------------------------------------------*/

//Send
void init(char *buffer, int id){
	bzero(buffer, BUFFERSIZE);
	sprintf(buffer, "%d/%d/\n", INIT, id);

}

//Send
void update(char *buffer, int id, int state, int currentFloor, int nextDest, int direction, int destinationCount){
	bzero(buffer,BUFFERSIZE);
	sprintf(buffer, "%d/%d/%d/%d/%d/%d/%d/\n", UPDATE, id, state, currentFloor, nextDest, direction, destinationCount);

}


